package com.ruoyi.otc.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.web.api.vo.BusinessTopicsReqVo;
import com.ruoyi.web.api.vo.BusinessTopicsRespVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;//导包
import com.ruoyi.otc.mapper.BusinessTopicLogMapper;
import com.ruoyi.otc.domain.BusinessTopicLog;
import com.ruoyi.otc.service.IBusinessTopicLogService;
import com.ruoyi.common.core.text.Convert;

/**
 * 企业评测记录Service业务层处理
 *
 * @author gjp
 * @date 2023-10-24
 */
@Service
public class BusinessTopicLogServiceImpl extends ServiceImpl<BusinessTopicLogMapper, BusinessTopicLog> implements IBusinessTopicLogService
{
    @Autowired
    private BusinessTopicLogMapper businessTopicLogMapper;

    /**
     * 查询企业评测记录
     *
     * @param id 企业评测记录主键
     * @return 企业评测记录
     */
    @Override
    public BusinessTopicLog selectBusinessTopicLogById(Long id)
    {
        return businessTopicLogMapper.selectById(id);
    }

    /**
     * 查询企业评测记录列表
     *
     * @param businessTopicLog 企业评测记录
     * @return 企业评测记录
     */
    @Override
    public List<BusinessTopicLog> selectBusinessTopicLogList(BusinessTopicLog businessTopicLog)
    {
        return businessTopicLogMapper.selectList(new QueryWrapper<>(businessTopicLog));
    }

    /**
     * 新增企业评测记录
     *
     * @param businessTopicLog 企业评测记录
     * @return 结果
     */
    @Override
    public int insertBusinessTopicLog(BusinessTopicLog businessTopicLog)
    {
                businessTopicLog.setCreateTime(DateUtils.getNowDate());
            return businessTopicLogMapper.insert(businessTopicLog);
    }

    /**
     * 修改企业评测记录
     *
     * @param businessTopicLog 企业评测记录
     * @return 结果
     */
    @Override
    public int updateBusinessTopicLog(BusinessTopicLog businessTopicLog)
    {
                businessTopicLog.setUpdateTime(DateUtils.getNowDate());
        return businessTopicLogMapper.updateById(businessTopicLog);
    }

    /**
     * 批量删除企业评测记录
     *
     * @param ids 需要删除的企业评测记录主键
     * @return 结果
     */
    @Override
    public int deleteBusinessTopicLogByIds(String ids)
    {
        return businessTopicLogMapper.deleteBatchIds(Arrays.asList(Convert.toStrArray(ids)));
    }

    /**
     * 删除企业评测记录信息
     *
     * @param id 企业评测记录主键
     * @return 结果
     */
    @Override
    public int deleteBusinessTopicLogById(Long id)
    {
        return businessTopicLogMapper.deleteById(id);
    }

    @Override
    public List<BusinessTopicsRespVo> getBusinessTopic(BusinessTopicsReqVo reqVo) {
        return businessTopicLogMapper.getBusinessTopic(reqVo);
    }
}
